* xcsv TIMET_TIME, TIMET_TIME_MS fix for the last fix.
e483407cf recently made a "fix" to TIMET_TIME_MS output. Unfortunately
it used a non-standard strftime specifier. While this worked on
linux systems it crashed with MSVC.
This removes strftime processing from TIMET_TIME_MS output. This makes
TIME_TIME, TIMET_TIME_MS analogous. Also input and output are
invertbile. Note that the documentation for these fields never mentioned
strptime or strftime, but says the are long intergers requiring long
integer printf conversions.
* Fix TIMET_TIME, TIMET_TIME_MS documentation.
These have been converted to 64 bit values to prepare for 2038.
* update style files for 64bit TIMET_TIME, TIMET_TIME_MS.
"IFIELD LON_DIRDECIMAL, \"\", \"%c/%f\"\n"
"IFIELD LAT_INT32DEG, \"\", \"%ld\"\n"
"IFIELD LON_INT32DEG, \"\", \"%ld\"\n"
- "IFIELD TIMET_TIME, \"\", \"%ld\"\n"
+ "IFIELD TIMET_TIME, \"\", \"%lld\"\n"
"IFIELD EXCEL_TIME, \"\", \"%f\"\n"
"# EPILOGUE:\n"
"#\n"
"# INDIVIDUAL DATA FIELDS:\n"
"#\n"
- "IFIELD TIMET_TIME,\"\",\"%ld\"\n"
+ "IFIELD TIMET_TIME,\"\",\"%lld\"\n"
"IFIELD LAT_DECIMAL, \"\", \"%f\"\n"
"IFIELD LON_DECIMAL, \"\", \"%f\"\n"
"IFIELD ALT_FEET, \"\", \"%fF\"\n"
"IFIELD IGNORE,\"\",\"%s\" # repetitions\n"
"IFIELD TEMPERATURE,\"\",\"%.1f\"\n"
"IFIELD IGNORE,\"\",\"%s\" # instant torque crank\n"
- "IFIELD TIMET_TIME_MS,\"\",\"%ld\"\n"
+ "IFIELD TIMET_TIME_MS,\"\",\"%lld\"\n"
"IFIELD ALT_METERS,\"\",\"%.1f\"\n"
"IFIELD POWER,\"\",\"%.0f\"\n"
"IFIELD IGNORE,\"\",\"%s\" # strides\n"
"IFIELD ALT_FEET, \"\", \"%fF\"\n"
"IFIELD ALT_METERS, \"\", \"%fM\"\n"
"IFIELD EXCEL_TIME, \"\", \"%f\"\n"
- "IFIELD TIMET_TIME, \"\", \"%ld\"\n"
+ "IFIELD TIMET_TIME, \"\", \"%lld\"\n"
"IFIELD GEOCACHE_DIFF,\"\",\"%3.1f\"\n"
"IFIELD GEOCACHE_TERR,\"\",\"%3.1f\"\n"
"IFIELD GEOCACHE_CONTAINER,\"\",\"%s\"\n"
IFIELD LON_DIRDECIMAL, "", "%c/%f"
IFIELD LAT_INT32DEG, "", "%ld"
IFIELD LON_INT32DEG, "", "%ld"
-IFIELD TIMET_TIME, "", "%ld"
+IFIELD TIMET_TIME, "", "%lld"
IFIELD EXCEL_TIME, "", "%f"
# EPILOGUE:
#
# INDIVIDUAL DATA FIELDS:
#
-IFIELD TIMET_TIME,"","%ld"
+IFIELD TIMET_TIME,"","%lld"
IFIELD LAT_DECIMAL, "", "%f"
IFIELD LON_DECIMAL, "", "%f"
IFIELD ALT_FEET, "", "%fF"
IFIELD IGNORE,"","%s" # repetitions
IFIELD TEMPERATURE,"","%.1f"
IFIELD IGNORE,"","%s" # instant torque crank
-IFIELD TIMET_TIME_MS,"","%ld"
+IFIELD TIMET_TIME_MS,"","%lld"
IFIELD ALT_METERS,"","%.1f"
IFIELD POWER,"","%.0f"
IFIELD IGNORE,"","%s" # strides
IFIELD ALT_FEET, "", "%fF"
IFIELD ALT_METERS, "", "%fM"
IFIELD EXCEL_TIME, "", "%f"
-IFIELD TIMET_TIME, "", "%ld"
+IFIELD TIMET_TIME, "", "%lld"
IFIELD GEOCACHE_DIFF,"","%3.1f"
IFIELD GEOCACHE_TERR,"","%3.1f"
IFIELD GEOCACHE_CONTAINER,"","%s"
/* Time as Excel Time */
wpt->SetCreationTime(excel_to_timet(atof(s)));
break;
- case XT_TIMET_TIME:
+ case XT_TIMET_TIME: {
/* Time as time_t */
- wpt->SetCreationTime((time_t) atol(s));
- break;
+ bool ok;
+ wpt->SetCreationTime(value.toLongLong(&ok));
+ if (!ok) {
+ warning("parse of string '%s' on line number %d as TIMET_TIME failed.\n", s, line_no);
+ }
+ }
+ break;
case XT_TIMET_TIME_MS: {
/* Time as time_t in milliseconds */
bool ok;
buff = QString::asprintf(fmp.printfc.constData(), timet_to_excel(wpt->GetCreationTime().toTime_t()));
break;
case XT_TIMET_TIME:
- /* time as a time_t variable */
- {
- time_t tt = wpt->GetCreationTime().toTime_t();
- buff = QString::asprintf(fmp.printfc.constData(), tt);
- }
- break;
-
- case XT_TIMET_TIME_MS: {
+ /* time as a time_t variable in seconds */
+ buff = QString::asprintf(fmp.printfc.constData(), wpt->GetCreationTime().toSecsSinceEpoch());
+ break;
+ case XT_TIMET_TIME_MS:
/* time as a time_t variable in milliseconds */
- buff = writetime("%s", wpt->GetCreationTime().toTime_t(), false);
- buff += QString::asprintf("%03d", wpt->GetCreationTime().time().msec());
-
- }
- break;
+ buff = QString::asprintf(fmp.printfc.constData(), wpt->GetCreationTime().toMSecsSinceEpoch());
+ break;
case XT_YYYYMMDD_TIME:
buff = QString::asprintf(fmp.printfc.constData(), time_to_yyyymmdd(wpt->GetCreationTime()));
break;
<section id="style_def_timettime">
<title>TIMET_TIME</title>
<para>TIMET_TIME is the waypoint's creation time, if any. This is actually
- the integer seconds since 1/1/1970 (let's not start the holy war) and
- is handled internally as a LONG INTEGER and requires a LONG INTEGER
+ the integer seconds since 1970-01-01T00:00:00 UTC. It
+ is handled internally as a 64 bit integer and requires a LONG LONG INTEGER
printf conversion.
</para>
<para>example:
</para>
- <screen format="linespecific">IFIELD TIMET_TIME,"","%ld"
+ <screen format="linespecific">IFIELD TIMET_TIME,"","%lld"
</screen>
</section>
<section id="style_def_timettimems">
<title>TIMET_TIME_MS</title>
<para>TIMET_TIME_MS is the same as TIMET_TIME, but expressed in milliseconds.
- It too is handled internally as a LONG INTEGER and requires a LONG INTEGER
+ It too is handled internally as a 64 bit integer and requires a LONG LONG INTEGER
printf conversion.
</para>
<para>example:
</para>
- <screen format="linespecific">IFIELD TIMET_TIME_MS,"","%ld"
+ <screen format="linespecific">IFIELD TIMET_TIME_MS,"","%lld"
</screen>
</section>
<section id="style_def_yyyymmdd">